package com.huaxin.device.models;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 环境检测仪数据
 */
@Data
@TableName("device_readings_environment")
public class DeviceReadingEnvironment {

    /**
     * 唯一ID（UUID）- 主键
     */
    @TableId(value = "id", type = IdType.ASSIGN_UUID)
    private String id;

    /**
     * 自增序列号（唯一索引，非主键）
     */
    @TableField(value = "auto_id")
    private Long autoId;

    /**
     * 创建时间
     */
    @TableField(value = "created_at", fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createdAt;

    /**
     * 创建人
     */
    @TableField(value = "created_by", fill = FieldFill.INSERT)
    private String createdBy;

    /**
     * 组织ID
     */
    @TableField(value = "org_id")
    private String orgId;

    /**
     * 设备实例ID
     */
    @TableField(value = "device_id")
    @Schema(description = "设备实例ID", example = "d123e456-789a-bcde-f012-3456789abcde")
    private String deviceId;

    /**
     * 温度（℃）
     */
    @TableField(value = "temperature")
    @Schema(description = "温度（℃）", example = "25.50")
    private BigDecimal temperature;

    /**
     * 湿度（%）
     */
    @TableField(value = "humidity")
    @Schema(description = "湿度（%）", example = "60.00")
    private BigDecimal humidity;

    /**
     * 是否检测到烟雾：0=否，1=是
     */
    @TableField(value = "smoke_detected")
    @Schema(description = "是否检测到烟雾：0=否，1=是", example = "0")
    private Boolean smokeDetected;

    /**
     * 一氧化碳浓度（ppm）
     */
    @TableField(value = "co_level")
    @Schema(description = "一氧化碳浓度（ppm）", example = "5.20")
    private BigDecimal coLevel;

    /**
     * PM2.5（μg/m³）
     */
    @TableField(value = "pm25")
    @Schema(description = "PM2.5（μg/m³）", example = "35")
    private Integer pm25;

    /**
     * 噪音（dB）
     */
    @TableField(value = "noise_level")
    @Schema(description = "噪音（dB）", example = "45.60")
    private BigDecimal noiseLevel;
}